package com.leejxx.health.pojo;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.handler.inter.IExcelDataModel;
import cn.afterturn.easypoi.handler.inter.IExcelModel;
import lombok.Data;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.util.Date;

/**
 * 预约设置
 */
@Data
public class OrderSetting implements Serializable, IExcelModel, IExcelDataModel {
    public static final String DATE_REGEXP = "^\\d{4}-\\d{1,2}-\\d{1,2}";
    public static final String NUMBER_REGEXP = "^(0|[1-9][0-9]*)$";

    //行号
    private int rowNum;

    //错误消息
    private String errorMsg;

    private Integer id;

    @Excel(name = "日期", importFormat = "yyyy-MM-dd")
    @Pattern(regexp = DATE_REGEXP, message = "预约时间格式错误")
    @NotNull(message = "预约时间不能为空")
    private String orderDate;//预约设置日期

    @Excel(name = "可预约数量")
    @Pattern(regexp = NUMBER_REGEXP, message = "可预约数量格式错误")
    @NotNull(message = "可预约数量不能为空")
    private String number;//可预约人数

    private int reservations;//已预约人数

    public OrderSetting() {
    }

    public OrderSetting(String orderDate, String number) {
        this.orderDate = orderDate;
        this.number = number;
    }
}
